-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为得各下游项目命名一致,可给 0x1 0x2 0x3
起名,例如 EF_LOONGARCH_FPABI_S
EF_LOONGARCH_FPABI_F
EF_LOONGARCH_FPABI_D
这样。反正 binutils 那边也必须起名。
docs/LoongArch-ELF-ABI-EN.adoc
Outdated
The ABI type of an ELF object is uniquely identified by `e_flags[7:0]` in its header. | ||
The ABI type of an ELF object is uniquely identified by `e_flags[7:0]` and `EI_CLASS` in its header. | ||
Within this combination, `e_flags[2:0]` and `EI_CLASS` correspond to the **base ABI** type, | ||
where `EI_CLASS` determines how C integral and pointer types are expressed (<<c-lang-data-model, data model>>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of EI_CLASS
is inaccurate.
See http://www.sco.com/developers/gabi/latest/ch4.eheader.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这儿不是对 EI_CLASS
本身语义的描述,而是 "借用" EI_CLASS 标记龙芯架构基础 ABI 类型信息,如 ELF32 只容纳 ilp32*
ABI 的程序。如果确实容易引起误解的话,应该怎么修改比较好呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RISC-V 那边是这么写的:
EI_CLASS
Specifies the base ISA, either RV32 or RV64. We don’t let users link RV32 and RV64 code together.
好像也有这个问题……
改成 "the expression of C integral and pointer types are uniquely determined by EI_CLASS value, we don't support LP64 ABIs with ELFCLASS32 or ILP32 ABIs with ELFCLASS64" 这样?
这个我们再讨论一下吧... base ABI 还是一个整体,不是特别希望 |
这可能就是个取名问题,不希望被理解成 FPABI 的话,那我觉得叫 FPABI_MARKER 之类一眼能看出来不是独立组成部分的名字就好了。 |
2bca885
to
4da1932
Compare
docs/LoongArch-ELF-ABI-EN.adoc
Outdated
|
||
[%header,cols="1,1,1,1"] | ||
|==== | ||
| Bit 31 - 8 | Bit 7 - 6 | Bit 5 - 3 | Bit 2 - 0 | ||
| (reserved) | ABI version | ABI extension | Base ABI | ||
| (reserved) | ABI version | ABI extension | Base ABI (partial) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should give bits[2-0] a better name. Something like 'FP ABI Maker' as @xen0n proposed can be considered?
感谢提议,要不我们改叫 |
…rchTargetStreamer Reference: https://github.com/loongson/LoongArch-Documentation The last commit hash (main branch) is: 99016636af64d02dee05e39974d4c1e55875c45b Note: There are several PRs [1][2][3] that may affect the e_flags. After they got closed or merged, we should update the implementation here accordingly. [1] loongson/LoongArch-Documentation#33 [2] loongson/LoongArch-Documentation#47 [2] loongson/LoongArch-Documentation#61 Differential Revision: https://reviews.llvm.org/D130239
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
起一下 ELF 常量名字?Base ABI Modifier, |
|
现在是叫 /* Processor specific flags for the ELF header e_flags field. */
/*The flag lp64s/lp64f/lp64d/ilp32s/ilp32f/ilp32d 3bits. */
#define EF_LOONGARCH_ABI_LP64_SOFT_FLOAT 0x1
#define EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT 0x2
#define EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT 0x3
#define EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT 0x5
#define EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT 0x6
#define EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT 0x7
#define EF_LOONGARCH_ABI_MASK 0x7
#define EF_LOONGARCH_ABI_ILP32_MASK 0x4
#define EF_LOONGARCH_ABI_FLOAT_MASK 0x3
#define EF_LOONGARCH_ABI_SOFT_FLOAT_MASK 0x1
#define EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK 0x2
#define EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK 0x3
#define EF_LOONGARCH_ABI(abi) (EF_LOONGARCH_ABI_MASK & (abi))
#define EF_LOONGARCH_IS_LP64(abi) \
(EF_LOONGARCH_ABI(abi) && (!(EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK)))
#define EF_LOONGARCH_IS_ILP32(abi) \
(EF_LOONGARCH_ABI(abi) && (EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK))
#define EF_LOONGARCH_IS_SOFT_FLOAT(abi) \
(!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SOFT_FLOAT_MASK))
#define EF_LOONGARCH_IS_SINGLE_FLOAT(abi) \
(!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK))
#define EF_LOONGARCH_IS_DOUBLE_FLOAT(abi) \
(!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK)) 那叫 |
/* Processor specific flags for the ELF header e_flags field. */
/* Base ABI modifier, 3bits. */
#define EF_LOONGARCH_ABI_SOFT_FLOAT 0x1
#define EF_LOONGARCH_ABI_SINGLE_FLOAT 0x2
#define EF_LOONGARCH_ABI_DOUBLE_FLOAT 0x3
#define EF_LOONGARCH_ABI_MODIFIER_MASK 0x7
#define EF_LOONGARCH_ABI_MODIFIER(abi) (EF_LOONGARCH_ABI_MODIFIER_MASK & (abi))
#define EF_LOONGARCH_IS_SOFT_FLOAT(abi) \
(EF_LOONGARCH_ABI_MODIFIER(abi) == EF_LOONGARCH_ABI_SOFT_FLOAT)
#define EF_LOONGARCH_IS_SINGLE_FLOAT(abi) \
(EF_LOONGARCH_ABI_MODIFIER(abi) == EF_LOONGARCH_ABI_SINGLE_FLOAT)
#define EF_LOONGARCH_IS_DOUBLE_FLOAT(abi) \
(EF_LOONGARCH_ABI_MODIFIER(abi) == EF_LOONGARCH_ABI_DOUBLE_FLOAT) |
文档是不是可以合了,至于代码中如何改可以参考这个。
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rchTargetStreamer Reference: https://github.com/loongson/LoongArch-Documentation The last commit hash (main branch) is: 99016636af64d02dee05e39974d4c1e55875c45b Note: There are several PRs [1][2][3] that may affect the e_flags. After they got closed or merged, we should update the implementation here accordingly. [1] loongson/LoongArch-Documentation#33 [2] loongson/LoongArch-Documentation#47 [2] loongson/LoongArch-Documentation#61 Differential Revision: https://reviews.llvm.org/D130239
Update handling of e_flags according to the documentation update [1] (discussions [2][3]). Object file bitness is now represented in the EI_CLASS byte. The e_flags field is now interpreted as follows: e_flags[2:0]: Base ABI modifier - 0x1: soft-float - 0x2: single-precision hard-float - 0x3: double-precision hard-float e_flags[7:6]: ELF object ABI version - 0x0: v0 - 0x1: v1 [1]: https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc#e_flags-identifies-abi-type-and-version [2]: loongson/LoongArch-Documentation#61 [3]: loongson/LoongArch-Documentation#47
Update handling of e_flags according to the documentation update [1] (discussions [2][3]). Object file bitness is now represented in the EI_CLASS byte. The e_flags field is now interpreted as follows: e_flags[2:0]: Base ABI modifier - 0x1: soft-float - 0x2: single-precision hard-float - 0x3: double-precision hard-float e_flags[7:6]: ELF object ABI version - 0x0: v0 - 0x1: v1 [1]: https://github.com/loongson/LoongArch-Documentation/blob/main/docs/LoongArch-ELF-ABI-EN.adoc#e_flags-identifies-abi-type-and-version [2]: loongson/LoongArch-Documentation#61 [3]: loongson/LoongArch-Documentation#47 (cherry picked from commit c4a7e6b)
No description provided.